﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using BLL.Admin;



public partial class Login : System.Web.UI.Page
{
    /// <summary>
    /// 登录
    /// </summary>

   
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            #region 原登录验证
            DataTable dt_admin = new DataTable();
            string strMd5UserPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassWord.Text.ToString().Trim(), "md5");
            dt_admin = AdminServices.S_selectOneAdminByName(txtName.Text.ToString().Trim())[0];
            if (dt_admin.Rows[0][2].ToString().Trim() == strMd5UserPwd.ToString().Trim())
            {
                Session["AID"] = dt_admin.Rows[0][0].ToString().Trim();
                Session["ALID"] = dt_admin.Rows[0][1].ToString().Trim();
                Session["admin"] = "1";

                Response.Redirect("Index.aspx");
            }
            #endregion
            //Response.Redirect("Index.aspx");
        }
        catch (Exception ex)
        {
        }
    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        txtPassWord.Text = "";
        txtName.Text = "";
    }
}
